package 猫和狗接口版;
/*
测试类
 */
public class AnimalDemo {
    public static void main(String[] args) {
        //创建对象 调用方法
        Jumpping j =new Cat();
        j.jumpping();

        Animal a=new Cat();
        a.setName("加菲");
        a.setAge(10);
        System.out.println(a.getName()+","+a.getAge());
        a.eat();
//        ((Cat) a).jumpping();

        a=new Cat("加菲",10);
        System.out.println(a.getName()+","+a.getAge());
        a.eat();
//        ((Cat) a).jumpping();

        //子类中有最多的实现方法
        Cat c=new Cat();
        c.setName("加菲");
        c.setAge(20);
        System.out.println(c.getName()+","+c.getAge());
        c.eat();
        c.jumpping();

        Jumpping j1 =new Dog();
        j1.jumpping();

        Animal b=new Dog();
        b.setName("旺财");
        b.setAge(20);
        System.out.println(b.getName()+","+b.getAge());
//        ((Dog)b).jumpping();
        b=new Dog("旺财",20);
        System.out.println(b.getName()+","+b.getAge());
        b.eat();
//        ((Dog)b1).jumpping();

        Dog d =new Dog();
        d.setName("旺财");
        d.setAge(20);
        System.out.println(d.getName()+","+d.getAge());
        d.eat();
        d.jumpping();

    }
}
